<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="org.liufeng.course.service.RequestService"%> 
<%@ page import="net.sf.json.*"%> 
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
try{
String json = RequestService.httpRequest("http://fhs.fxpt.org:8090/HyDroDataService/service/queryZZSpace.action","utf-8");
JSONObject ob=JSONObject.fromObject(json);
JSONArray array=ob.getJSONArray("result");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>

<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>河道水位</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script type="text/javascript" src="js/jquery-1.4.4.min.js"></script>
	
<style type="text/css">
.info{width:100%; background:#c0c0c0;}
.info td,.info th{padding:4px;line-height:40px;font-size: 25;}
.info td{background:#fff; text-align:center;}
.info td.aleft{text-align:left;}
.info td.prohead{background:#eaf3ff}
.info th{text-align:center; color:#333; font-weight:bold; verticle-align:middle; background:#eee;white-space:nowrap;}
.info tr.overcolor td{background:#fcfbcc}
.info td.prohead{background:#6AB4FF}
.red font{ color:red;  }
.info tr:hover td{
background-color:#D1F1F1;    
}


</style>
	<script type="text/javascript">
	jQuery.ajaxSetup ({
	   		 cache:false
	    })
	    
	 function truan(stcd){
	 	window.location.href = "waterLevelInfo.jsp?stcd="+stcd;
	 }
	 
	 
	</script>
  </head>
  
  <body>
    <div id="menubox1">
    <p style="color:red">说明：</p>
			<p style="color:red">1、数据为红色则表示已超警戒水位。</p>
			<p style="color:red">2、点击遥测站后进入详情页。</p>
		 <table class="info" id="info">
			 <tr id="th"><th>遥测站名</th><th>水位(m)</th></tr>
			 <%for(int i=0;i<array.size();i++){
				  String isWarn = array.getJSONObject(i).get("isWarn").toString();
				  String stcd = array.getJSONObject(i).get("STCD").toString();
			  %>	
			  <tr id='<%=stcd %>' <%if(isWarn.equals("1")){out.print("class='red'");} %> onclick="truan('<%=stcd %>')" >
				  <td>
					  <font><%= array.getJSONObject(i).get("STNM")%> </font>
				  </td>
				   <td>
					  <font><%=array.getJSONObject(i).get("Z")%></font>
				  </td>
			  </tr>
			 <%} }catch(Exception e){ %>
			 		<img src="/pic/error.jpg" style = "width:100%">
			  <%}%>
		</table>
	</div>
  </body>
</html>
